/*
 * Copyright (c) 2010 CCX(China) Co.,Ltd. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * CCX(China) Co.,Ltd. ("Confidential Information").
 * It may not be copied or reproduced in any manner without the express 
 * written permission of CCX(China) Co.,Ltd.
 *
 * @author wangyaoxi
 * Date: 2010-7-16 上午10:42:44
 */
package com.ccxe.manage.service.impl;

import com.ccxe.manage.dao.impl.IM_Menu_Role_DaoImpl;
import com.ccxe.manage.dao.impl.RoleDaoImpl;
import com.ccxe.manage.dao.impl.UserRoleDaoImpl;

/**
 * @author wangyx
 * 
 */
public class RoleDeleteTransactionService extends TransactionService {

	private RoleDaoImpl roleDao = new RoleDaoImpl();
	private IM_Menu_Role_DaoImpl menu_role_dao = new IM_Menu_Role_DaoImpl();
	private UserRoleDaoImpl user_role_dao = new UserRoleDaoImpl();

	private String roleId;

	public RoleDeleteTransactionService(String roleId) {
		this.roleId = roleId;
	}

	@Override
	protected void doTransactionOperate() {
		try {
			String[] parms = new String[] { roleId };
			// 删除角色--权限关系表
			tranDb.executeUpdate(menu_role_dao.getDeleteByRoleIdSql(), parms);
			// 删除角色--用户 关系表
			tranDb.executeUpdate(user_role_dao.getDeleteByRoleSql(), parms);
			// 删除角色
			tranDb.executeUpdate(roleDao.getDeleteSql(), parms);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
